// 引入express模块
const express = require("express");

// 创建路由器对象
const router = express.Router();

// 引入连接池
const pool = require("../pool");

// 添加路由
// 1.社区页面轮播图接口 get /swiper
router.get("/swiper", (req, res, next) => {
  let sql = "select * from community-carousel";
  pool.query(sql, (err, data) => {
    if (err) {
      next(err);
      return;
    }
    // console.log(data);
    if (data.length > 0) {
      res.send({ code: 200, msg: "ok", results: result });
    } else {
      res.send({ code: 301, msg: "未查询到任何数据" });
    }
  });
});
